import Mock from 'mockjs'
import { orgApis } from '../../src/api/apiList/org'
const cH = '/'

const rowsArr = {
  'carSeries':{
    'carCode|1':['AA','BB','CC','DD'],   //车系编码
    'carName|1':['岚图A系','岚图B系','岚图C系','岚图D系'],   //车系名称
    'enName|1':['LENA','LENB','LENC','LEND'],    //英文名称
    'array|+1':1,           //排列顺序
    'state|1':['启用','停用'],   //状态
  },
  'carType':{
    'carCode|1':['AA','BB','CC','DD'],   //车系编码
    'carName|1':['岚图A系','岚图B系','岚图C系','岚图D系'],   //车系名称
    'carModelCode|1':['AA型','BB型','CC型','DD型'],   //车型编码
    'carModelName|1':['岚图A型','岚图B型','岚图C型','岚图D型'],   //车型名称
    'state|1':['启用','停用'],   //状态
  },
  'carModel':{
    'carCode|1':['AA','BB','CC','DD'],   //车系编码
    'carName|1':['岚图A系','岚图B系','岚图C系','岚图D系'],   //车系名称
    'carModelCode|1':['AA型','BB型','CC型','DD型'],   //车型编码
    'carModelName|1':['岚图A型','岚图B型','岚图C型','岚图D型'],//车型名称
    'optionalPackCode|1':['code1','code2','code3','code4'], //选装包编码
    'optionalPackName|1':['岚图A包','岚图B包','岚图C包','岚图D包'], //选装包
    'optionalPackPrice|+10':100,
    'optionalPackState|1':true,
    'InteriorColorCode|1':['红色','橙色','黄色','绿色'],//内饰颜色编码
    'InteriorColorName|1':['红色','橙色','黄色','绿色'],//内饰颜色
    'InteriorColorState|1':true,
    'carColorCode|1':'@color',
    'carColorName|1':['红色','橙色','黄色','绿色'],
    'carColorState|1':true,
    'state|1':['启用','停用'],   //状态
  },
'totalInfor':{
  'warehouseCode|1':['岚图A仓','岚图B仓','岚图C仓','岚图D仓'],   //仓库名称
  'warehouseName|1':['岚图A码','岚图B码','岚图C码','岚图D码'],   //仓库编码
  'state|1':['启用','停用'],   //状态
  'warehouseType|1':['总部仓库','分部仓库','门店仓库','总部A仓库'],  //仓库类型
  'manage|1':['张三','李四','王五'], //管理员
  'iphone|1':['1839299229','15839400958','15029304758'], //电话
  'email|1':['1839299229@163.com','15839400958@163.com','15029304758@163.com'], //传真
  'city|1':'@city()', //城市
  'address|1':['岚图888号','岚图666号','岚图999号','岚图000号'], //地址
  'postcode|1':['430000','430014','430070','430080'], //邮编
  'warehouseCode|1':['1000立方','1000立方','1000立方','1000立方'],   //仓库容量
  'logistics|1':['岚图仓','岚图仓','岚图仓','岚图仓'],//物流仓库容量
  'remarks|1':['可生产','可销售','可转仓','可停用'],//备注
  'bigHouse|1':['华南大区','华中大区','华北大区','华东大区'],//大区
  'smallHouse|1':['华南小区','华中小区','华北小区','华东小区'],//小区
  'center|1':['湖北省','湖南省','广东省','河南省'],//省份
  'district|1':['武昌区','汉阳区','江岸区','江汉区'],//区县
  move:'岚图总部仓',//搬入地
  store:'岚图',   //门店名称
  'storeCode|1':['岚图A店','岚图B店','岚图C店','岚图D店'],//门店编码
  'storeType|1':['岚图A类','岚图B类','岚图C类','岚图D类'],//门店类别
},
"move":{
  'moveCode|1':['HF1321123KADAS','HF00000KADAS','HF111111KADAS','HF22222KADAS'],//移库单
  wherehouse:'总部仓库',
  objective:'目的库',
  'state|1':true,
  'opinion|1':true,
  'VIN|+1':1,
  'car|+1':1,
  carName:'@cname',
  'carColor|1':'@color',
  'insideColor|1':['红色','橙色','黄色','绿色'],//内饰颜色
  name:'@cname',
  time:'@date(yy-mm-dd)',
  sname:'@cname',
  stime:'@date(yy-mm-dd)',




    'VINCode|+1': 0, //	厂商名称
    'center|1': ['湖北省','河南省','广东省','安徽省','四川省','江西省'], //	厂商编码
    // isEnable: '1', //	厂商ID
    wareHouse: '默认', //	管理员账号
    'wareHouse|': ['有效','无效'], //	管理员密码
    'roleId|1': ['直营','加盟'], //	角色ID
    houseAddress: '武汉22222', //	状态
    objective: '10万方', //	备注
    'objectiveAddress|+1': '联友科技', // 供应商全称
    'orgName|1': ['武汉仓','上海仓','天津仓','城都仓','重庆仓'],
    roleName: '1111',
    isEnable: "1",
    userId: '北京',
    'updateControlId|1': ['武汉市','上海市','天津市','城都市','重庆市'],
    updateControl: '青年小区',
    updateControlTime: '湖北省',
    "up|1": ['0.2','0.4','0.44','0.9'],
    "down|1":['0.11','0.22','0.33'],

  }
}

export default [
  //车系维护
  {
    url:'/org/carSeries',
    type:'post',
    data:{},
    response:config => {
      const { pageSize } = config.body
      let returnList = Array(pageSize).fill(rowsArr.carSeries)

      // 查询条件过滤
      var params = config.body
      // console.log(params)
      if (params) {
        if (params.carCode !== '') {
          console.log(returnList)
          returnList = returnList.filter(o => o.carCode === params.carCode)
        }
        if (params.carName !== '') {
          returnList = returnList.filter(o => o.carName.indexOf(params.carName) > -1)
        }
        if (params.isEnable !== '') {
          returnList = returnList.filter(o => o.isEnable === params.isEnable)
        }
      }
      return {
        'result': '1',
        'msg': 'success',
        'rows': returnList
      }
    }
  },
  //车型维护
  {
    url:'/org/carType',
    type:'post',
    data:{},
    response:config => {
      const { pageSize } = config.body
      var list = Array(pageSize).fill(rowsArr.carType)
      return {
        'result': '1',
        'msg': 'success',
        'rows': list
      }
    }
  },
    //车型配置维护
    {
      url:'/org/carModel',
      type:'post',
      data:{},
      response:config => {
        const { pageSize } = config.body
        var list = Array(pageSize).fill(rowsArr.carModel)
        return {
          'result': '1',
          'msg': 'success',
          'rows': list
        }
      }
    },

  //总部仓库维护
{
  url:'/org/totalInfor',
  type:'post',
  data:{},
  response:config => {
    const { pageSize } = config.body
    var list = Array(pageSize).fill(rowsArr.totalInfor)
    return {
      'result': '1',
      'msg': 'success',
      'rows': list
    }
  }
},
//总部移库指令
{
  url:'/org/move',
  type:'post',
  data:{},
  response:config => {
    const { pageSize } = config.body
    var list = Array(pageSize).fill(rowsArr.move)
    return {
      'result': '1',
      'msg': 'success',
      'rows': list
    }
  }
}

  // {
  //   url: orgApis.stoTransferInstructionQueryByPage.APIUrl,
  //   type: 'post',
  //   response: config => {
  //     // console.log(rowsArr)
  //     var returnList = rowsArr
  //     // 查询条件过滤
  //     var params = config.body
  //     if (params) {
  //       if (params.VINCode !== '') {
  //         returnList = returnList.filter(o => o.VINCode === params.VINCode)
  //       }
  //       // if (params.carBrandCn !== '') {
  //       //   returnList = returnList.filter(o => o.carBrandCn.indexOf(params.carBrandCn) > -1)
  //       // }
  //       // if (params.isEnable !== '') {
  //       //   returnList = returnList.filter(o => o.isEnable === params.isEnable)
  //       // }
  //     }
  //     // 分页过滤
  //     returnList.forEach((item, index) => {
  //       item['index'] = index
  //     })
  //     console.info(returnList)
  //     const minIndex = (config.body.pageIndex - 1) * config.body.pageSize
  //     const maxIndex = minIndex + config.body.pageSize
  //     returnList = returnList.filter(o => o.index >= minIndex && o.index < maxIndex)
  //     return {
  //       'msg': '',
  //       'result': '1',
  //       'rowcount': returnList.length,
  //       'rows': returnList
  //     }
  //   }
  // }
]
